home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
- CEditPane.c
-
- Methods for a text editing pane.
-
- Copyright ⌐ 1989 Symantec Corporation. All rights reserved.
-
- ******************************************************************************/
-
-
- #include "CEditPane.h"
- #include <Commands.h>
- #include <CDocument.h>
- #include <CBartender.h>
- #include <Constants.h>
- #include "Recognizer.h"
- extern CBartender *gBartender;
-
- void CEditPane::IEditPane(CView *anEnclosure, CBureaucrat *aSupervisor)
-
- {
- Rect margin;
- TextFont(monaco);
- TextSize(9);
- CEditText::IEditText(anEnclosure, aSupervisor, 1, 1, 0, 0,
- sizELASTIC, sizELASTIC, 700);
- FitToEnclosure(TRUE, TRUE);
-
- /**
- ** Give the edit pane a little margin.
- ** Each element of the margin rectangle
- ** specifies by how much to change that
- ** edge. Positive values are down and to
- ** right, negative values are up and to
- ** the left.
- **
- **/
-
- SetRect(&margin, 2, 2, -2, -2);
- ChangeSize(&margin, FALSE);
- }
-
- void CEditPane::DoCommand(long theCommand)
-
- {
-
- if (((theCommand == cmdPaste) || (theCommand == cmdCut)) &&
- !((CDocument *)itsSupervisor)->dirty) {
-
- ((CDocument *)itsSupervisor)->dirty = TRUE;
- gBartender->EnableCmd(cmdSave);
- gBartender->EnableCmd(cmdSaveAs);
- }
-
- inherited::DoCommand(theCommand);
- }
-
-
- void CEditPane::DoKeyDown(char theChar, Byte keyCode, EventRecord *macEvent)
-
- {
-
- inherited::DoKeyDown(theChar, keyCode, macEvent);
-
- switch (keyCode) {
-
- case KeyHome:
- case KeyEnd:
- case KeyPageUp:
- case KeyPageDown:
- break;
-
- default:
- if (!((CDocument *)itsSupervisor)->dirty) {
- ((CDocument *)itsSupervisor)->dirty = TRUE;
- gBartender->EnableCmd(cmdSave);
- gBartender->EnableCmd(cmdSaveAs);
- }
- break;
- }
- }
-
-
- void CEditPane::DoAutoKey(char theChar, Byte keyCode, EventRecord *macEvent)
-
- {
-
- inherited::DoAutoKey(theChar, keyCode, macEvent);
-
- switch (keyCode) {
-
- case KeyHome:
- case KeyEnd:
- case KeyPageUp:
- case KeyPageDown:
- break;
-
- default:
- if (!((CDocument *)itsSupervisor)->dirty) {
- ((CDocument *)itsSupervisor)->dirty = TRUE;
- gBartender->EnableCmd(cmdSave);
- gBartender->EnableCmd(cmdSaveAs);
- }
- break;
- }
- }
-
- void CEditPane::AdjustCursor(Point where,RgnHandle mouseRgn)
- {
- SetCursor(&arrow);
- }
-
-
- void CEditPane::DoClick(Point hitPt,short modifierKeys,long when)
- {
- if (Wacom) {
- hitPt.h = TRecord->xCoord;
- hitPt.v = TRecord->yCoord;
- }
-
- inherited::DoClick(hitPt,modifierKeys,when);
- }
-
-
-